package aad.storyboard.model;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.ColorMatrix;

public class GreenFader implements Fader{

	Bitmap fadeBitmap;
	
	public GreenFader(Bitmap btm)
	{
		fadeBitmap = btm;   	
	}
	
	@Override
	public void fade(ColorMatrix cm, int contrast) {
		fadeBitmap.eraseColor(Color.GREEN); 
		setAlpha(cm, contrast);
		
	}
	
	private static void setAlpha(ColorMatrix cm, int contrast) {
		 float scale = contrast - 1.f; 
      	 cm.set(new float[] {
               0, 0, 0, 0, 0, 
               0, 255, 0, 0, 0,
               0, 0, 0, 0, 0, 
               0, 0, 0, 0, scale});
 }
   

}
